#ifndef ADDITEM_H
#define ADDITEM_H

#include <head/g_pch.h>

namespace Ui {
class AddItem;
}

class AddItem : public QDialog
{
    Q_OBJECT

public:
    explicit AddItem(const QString &category,
                     QWidget *parent = nullptr);
    ~AddItem();

    void prepare(const QStringList &properties,
                 const QStringList &columns=QStringList());

    void setItem(const QStringList &properties,
                 const QStringList &values,
                 const QStringList &columns=QStringList());

signals:
    void addItem(const QJsonObject &object);
    void updateItem(const QJsonArray &array);

private slots:
    void on_btn_submit_clicked();

private:
    Ui::AddItem *ui;

    bool editFlag;
    QString _category;
    QStringList _properties;
    QStringList _values;
    QStandardItemModel *model;
    QMap<QString,QString> _map;
};

#endif // ADDITEM_H
